package interfaces.spawnMenu.costumize.items;

import logic.items.Buyable;

import org.fenggui.binding.render.ImageFont;
import org.fenggui.util.Color;

import interfaces.GUISource;
import interfaces.superWidgets.InterfaceButton;
import interfaces.superWidgets.MoneyListener;

public class BuyableButton<T extends Buyable> extends InterfaceButton implements MoneyListener {
	
	protected T properties;
	
	public BuyableButton(T properties, ImageFont buttonFont) {
		super(properties.getName() + " (" + properties.getCosts() + ")", buttonFont);
		this.properties = properties;
	}
	
	public T getProperties() { return properties; }
	
	@Override
	public void updateMoney(int newMoney) {
		if(newMoney >= properties.getCosts()) GUISource.setTextColor(this, Color.WHITE);
		else GUISource.setTextColor(this, Color.RED);
	}
}